<template>
  <div class="listbage" @click="fn3">
      <div class="listbage_head">
        <div class="search">
            <span class="iconfont icon-arrow-right" @click="()=>this.$router.go(-1)"></span>
            <div class="search_inpit">
                <span class="iconfont icon-zoom"></span>
                请输入搜索内容
            </div>
        </div>
        <div class="rank">
            <li @click.stop="fn1(1)" :class="{off:aa===1} "> 
                综合排序
                <span class="iconfont icon-shouqishangjiantou-" v-if="aa===1"></span>
                <span class="iconfont icon-xiajiantou" v-else></span>
            </li>
            <li @click="fn1(2)" :class="{off:aa===2} ">
                销量优先
                </li>
            <li @click="fn1(3)" :class="{off:aa===3} ">
                筛选
                <span class="iconfont icon-shouqishangjiantou-" v-if="aa===3"></span>
                <span class="iconfont icon-xiajiantou" v-else></span>
            </li>
            <div class="rank_rigth" @click="fn2">
                <span class="iconfont icon-caidan" v-show="line"></span>
                <span class="iconfont icon-fenlei1" style="font-size:0.45rem" v-show="!line"></span>
            </div>

        </div>
        <div class="rank_tab" v-show="tab">
            <li>综合排序</li>
            <li>价格从高到低</li>
            <li>价格从低到高</li>
            <li>人气排序</li>
        </div>
      </div>
      <div class="listbage_content">
          <div class="shade" v-show="tab"></div>
          <div class="listbage_content_list" v-if="line">
            <ul>
                <img :src="$baseurl+'/'+item.img" alt="" class="brandimg" v-for="item in Himg" :key="item.id">
                <li v-for="item in arr" :key="item.id">
                    <img :src="$baseurl+'/'+item.img" alt="">
                    <div class="list_rigth" >
                        <h3>{{item.title}}</h3>
                        <h4>{{item.explain}}</h4>
                        <i>￥{{item.price}}</i>
                        <div><span>销量 {{item.sales}}</span><b>{{item.dealer}}</b> </div>
                    </div>
                </li>
            </ul>  
          </div>
          <div class="listbage_content_list2" v-else>
            <ul>
                <img :src="$baseurl+'/'+item.img" alt="" class="brandimg" v-for="item in Himg" :key="item.id">
                <li v-for="item in arr" :key="item.id">
                    <img :src="$baseurl+'/'+item.img" alt="">
                    <div class="list_bottom" >
                        <h3>{{item.title}} </h3>
                        <div class="list2_price"><i>￥{{item.price}}</i><span>{{item.discounts}}</span></div>
                        <div class="list_sales"><span>销量 {{item.sales}}</span><b>{{item.dealer}}</b> </div>
                    </div>
                </li>
            </ul>  

          </div>
          
      </div>

  </div>
</template>

<script>
export default {
    data(){
        return {
            aa:1,
            tab:false,
            line:true,
            arr:[],
            Himg:[],
            listCurl:'',
            imgHurl:''

        }
    },
    methods:{
        fn1(off){
            this.aa = off
            this.tab = !this.tab   
        },
        fn2(){
            this.line = !this.line
        },
        fn3(){
            if(this.tab===true){
                this.tab=false             
            }
        },
        async listCurldata(){
            this.listCurl=this.$route.query.listCurl
            let { data } = await this.$axios.get(this.$baseurl+'/'+this.listCurl)
            this.arr = data
        },
        async imgHurldata(){
            this.imgHurl=this.$route.query.imgHurl
            let { data } = await this.$axios.get(this.$baseurl+'/'+this.imgHurl)
            this.Himg = data
        }

    },
     created(){
        this.listCurldata()
        this.imgHurldata()

    }
    

}
</script>

<style lang='scss'>
.listbage{
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f9f9f9;
    .listbage_head{
        position: relative;
        .search{
            display: flex;
            padding: 0.88rem 0 0.18rem 0.16rem;
            border-bottom: 0.02rem solid #e8e8e8;
            color: #c5cdd9;
            span{
                display: inline-block;
                font-size: 0.45rem;
                line-height: 0.6rem;
                height:0.6rem;
                color:#666666;
            }
            .search_inpit{
                display: flex;
                align-items: center;
                height: 0.6rem;
                margin-left: 0.3rem;
                width: 6.16rem;
                border-radius: 0.06rem;
                background: #ededed;
                font-size: 0.28rem;
                span{
                    width: 0.72rem;
                    text-align: center;
                }
            }

        }
        .rank{
            .off{
                color: #d61619;
            }
            display: flex;
            padding:0 0.2rem;
            background: #fff;
            height: 1rem;
            align-items: center;
            justify-content:space-between;
            font-size: 0.28rem;
            color:#cdcdcd;
            li{
                display: flex;
                align-items: center;
                span{
                    font-size: 0.3rem;
                    font-weight: bold;
                    margin-left: 0.1rem;
                    
                }
            }
            span{
                font-size: 0.4rem;
                color: #000;
                margin-right: 0.1rem;
            }
            .rank_rigth{
                width:0.6rem;
            }
        }
        .rank_tab{
            background: #fff;
            position: absolute;
            width: 100%;
            z-index: 9999;
            li{
                height: 0.9rem;
                border-bottom: 0.01rem solid #e8e8e8;
                margin-left: 0.25rem;
                line-height: 1rem;
                font-size: 0.28rem;
                color: #000;
            }
        }
    }
    .listbage_content{
        flex: 1;
        display: flex;
        position: relative;
        overflow: hidden;
        
        .shade{
            height: 100%;
            width: 100%;
            background:rgba($color: #000, $alpha: 0.2);
            position: absolute;
        }
        .brandimg{
            height: 3.6rem;
            width: 100%;
        }
        .listbage_content_list{
            flex: 1;
            background: #fff;
            overflow: auto;
           ul{
               display: flex;
               flex-wrap: wrap;

               li{
                    height: 2.48rem;
                    width: 100%;
                    display: flex;
                    img{
                        height: 2.16rem;
                        width: 2.16rem;
                        margin: 0.16rem;
                    }
                
                    .list_rigth{
                        padding: 0.16rem 0.24rem 0.16rem 0;
                        flex: 1;
                        border-bottom: 0.02rem solid #e8e8e8;
                        h3{
                            font-size: 0.3rem;
                            line-height: 0.38rem;
                            color: #000;
                            font-weight: normal;
                            margin-bottom: 0.3rem;
                        }
                        h4{
                            font-size: 0.26rem;
                            line-height: 0.38rem;
                            color: #999;
                            font-weight: normal;
                        }
                        i{
                            font-size: 0.24rem;
                            line-height: 0.4rem;
                            color: #d61619;
                            font-style: normal;
                        }
                        div{
                            font-size: 0.24rem;
                            line-height: 0.32rem;
                            span{
                                color: #999;
                                float: left;
                            }
                            b{
                                color: #ec5464;
                                float: right;
                            }
                        }


                    }

                }

           }
            
        }
        .listbage_content_list2{
            flex: 1;
            overflow: auto;
            ul{
                display: flex;
                flex-wrap: wrap;
                li{
                    height: 5.74rem;
                    width: 3.52rem;
                    margin: 0.04rem;
                    display: flex;
                    flex-direction: column;
                    background: #fff;
                    img{
                        height: 3.52rem;
                        width: 3.52rem;
                    }
                    .list_bottom{
                        flex: 1;
                        padding: 0.24rem 0.2rem 0;
                        h3{
                            font-size: 0.28rem;
                            line-height: 0.28rem;
                            color: #000;
                            font-weight: normal;
                            margin-bottom: 0.13rem;
                            height: 0.56rem;
                            overflow : hidden;
                            text-overflow: ellipsis;
                            display:-webkit-box;
                            -webkit-line-clamp: 2;
                            -webkit-box-orient: vertical;
                            
                           
                            

                        }
                        .list2_price{
                            height: 0.6rem;
                            width: 100%;
                            font-size: 0.26rem;
                            line-height: 0.6rem;
                            color: #d61619;
                            i{
                                float: left;
                                font-style: normal;
                            }
                            span{
                                float: right;
                            }

                        }
                        .list_sales{
                            font-size: 0.28rem;
                            line-height: 0.4rem;
                            height: 0.4rem;
                            span{
                                color: #9b9b9b;
                                float: left;
                            }
                            b{
                                color: #fff;
                                background: #d61619;
                                float: right;
                                width: 0.56rem;
                                display: inline-block;
                                font-size: 0.24rem;
                                text-align: center;
                                font-weight: normal;
                            }
                        }
                    }


                }

            }
            
            

        }

    }
   
}

</style>